package cn.com.geoway.booksystem.dao;

import cn.com.geoway.booksystem.entity.Book;
import cn.com.geoway.booksystem.entity.Borrow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface BookDao extends JpaRepository<Book,Integer>,JpaSpecificationExecutor< Book> {
	
	
	@Query(value="select * from t_book where id = ?1",nativeQuery = true)
	public Book  findId(Integer id);

	@Query(value="select * from t_book where name = ?1",nativeQuery = true)
	public Book findByName(String name);

	@Query(value="select * from t_book where book_type_id = ?1",nativeQuery = true)
	public List<Book> findByTypeId(Integer id);
	
	
}
